package com.usf.jprovider.schema.condition;

import javax.xml.bind.annotation.XmlElement;

import com.usf.jprovider.object.JObjectNode;
import com.usf.jprovider.object.env.Environment;
import com.usf.jprovider.object.type.JType;
import com.usf.jprovider.schema.provider.AbstractProvider;
import com.usf.jprovider.schema.provider.EmptyProvider;

public final class EqualCondition extends AbstractCondition {

	@XmlElement protected AbstractProvider source;
	@XmlElement protected AbstractProvider value;

	public EqualCondition() {
		super();
		source = new EmptyProvider();
		value = new EmptyProvider();
	}
	public AbstractProvider getSource() {
		return source;
	}
	public AbstractProvider getValue() {
		return value;
	}

	@Override
	public boolean check(Environment env, JObjectNode node) throws Exception {
		JType<?> content = value.create(env, node);
		return source.checkValue(env, node, content);
	}

}
